﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ChoDiaOc_HK_WPF.Controls;
using ChoDiaOc_HK_WPF.Models;

namespace ChoDiaOc_HK_WPF.Views.LapBaoBieu {
    /// <summary>
    /// Interaction logic for ThongKeKhachHang.xaml
    /// </summary>
    public partial class ThongKeKhachHang : UserControl {
        private List<TKKhachHang> ListKhachHang;
        List<PHIEUDANGKY> query;
        public ThongKeKhachHang() {
            InitializeComponent();
            ListKhachHang = new List<TKKhachHang>();
            List<string> Thang = new List<string>();
            Thang.Add("1");
            Thang.Add("2");
            Thang.Add("3");
            Thang.Add("4");
            Thang.Add("5");
            Thang.Add("6");
            Thang.Add("7");
            Thang.Add("8");
            Thang.Add("9");
            Thang.Add("10");
            Thang.Add("11");
            Thang.Add("12");
            cbxThang.ItemsSource = Thang;
        }

        private void cbxThang_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            query = DatabaseWrapper.GetInstance().GetAllPhieuDangKy();
            int nam;
            if (int.TryParse(tbxNam.Text, out nam))
                ListKhachHang = TKKhachHang.getListKhachHang(query, int.Parse(cbxThang.SelectedItem.ToString()), nam);
            TKDTdataGrid.ItemsSource = ListKhachHang;
        }
    }
}
